package com.zq.新特性.lambda;

/**
 * @author Jiu
 * @description：TODO
 * @date 2020/12/07   15:12
 **/
public class MyLambda {
    public static void main(String[] args) {
        TestThread();


    }

    private static void TestThread() {
        new Thread(new Runnable() {
            @Override
            public void run() {
                System.out.println(Thread.currentThread().getName() + "新线程创建了");
            }
        }).start();

        //使用Lambda
        new Thread(() -> {
            System.out.println(Thread.currentThread().getName() + "新线程创建了");
        }).start();

        //优化lambda
        new Thread(() -> System.out.println(Thread.currentThread().getName() + "新线程创建了")).start();


        for (int i = 0; i < 8; i++) {
            new Thread(() -> System.out.println(Thread.currentThread().getName() + "新线程创建了")).start();
        }
    }

}
